package com.twu.biblioteca.library.main;

import com.twu.biblioteca.control.Strings;
import com.twu.biblioteca.library.shelf.BookShelf;
import com.twu.biblioteca.library.shelf.MovieShelf;
import com.twu.biblioteca.user.User;
import java.util.Scanner;

public class Library {

    BookShelf bookShelf;
    MovieShelf movieShelf;
    User currentUser;
    Scanner inputScanner;

    public Library(User currentUser, Scanner inputScanner) {
        bookShelf = new BookShelf();
        movieShelf = new MovieShelf();
        this.inputScanner = inputScanner;
        this.currentUser = currentUser;
    }

    public int menuListBooks() {
        return bookShelf.listItems();
    }

    public boolean menuCheckoutBook() {
        int id;
        System.out.println(Strings.bookEnterID);
        id = inputScanner.nextInt();
        return bookShelf.checkoutItem(id, currentUser.getLibraryNumber());
    }

    public boolean menuReturnBook() {
        int id;
        System.out.println(Strings.bookEnterID);
        id = inputScanner.nextInt();
        return bookShelf.returnItem(id);
    }

    public int menuListMovies() {
        return movieShelf.listItems();
    }

    public boolean menuCheckoutMovie() {
        int id;
        System.out.println(Strings.movieEnterID);
        id = inputScanner.nextInt();
        return movieShelf.checkoutItem(id, currentUser.getLibraryNumber());
    }

    public void menuUserInformation() {
        currentUser.printUserInfo();
    }
}
